﻿@model Citi.Scheduler.WebUi.Models.RoutineErrorHistoryModel
<script type="text/javascript">
    function closeDialogRoutineErrorHistory() {
        $("#divUpdateRoutineErrorHistory").dialog('close');
        clearForm();
    }

    function clearForm() {
        $("#formActionForm").trigger('reset');
    }
</script>
@using (Ajax.BeginForm("ActionForm", "RoutineErrorHistory", new AjaxOptions
{
    UpdateTargetId = "divIndexRoutineErrorHistory",
    InsertionMode = InsertionMode.Replace,
    OnComplete = "closeDialogRoutineErrorHistory"
}, new { id = "formActionForm" }))
{
    <div class="editor-label">
        @Html.LabelFor(model => model.Date)
    </div>
    <div class="editor-field">
        @Html.Label((Model.Id != 0 ? Model.Date : DateTime.Now).ToString("MM/dd/yyyy HH:mm"))
        @Html.HiddenFor(model => model.Date)
        @Html.ValidationMessageFor(model => model.Date)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.Description)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Description)
        @Html.ValidationMessageFor(model => model.Description)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.UserId)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(model => model.UserId, (IEnumerable<SelectListItem>)ViewBag.Users)
        @Html.ValidationMessageFor(model => model.UserId)
    </div>
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Status)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(model => model.Status, (IEnumerable<SelectListItem>)ViewBag.Status)
        @Html.ValidationMessageFor(model => model.Status)
    </div>
       
    @Html.HiddenFor(model => model.RoutineErrorId)

    if (Model != null)
    {
    @Html.HiddenFor(model => model.Id)
    }
    <p>
        <input type="submit" value="Save" />
    </p>
}
